package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type Config struct {
	Mysql
	Redis
}

type Mysql struct {
	Host     string
	Port     int
	User     string
	Password string
}

type Redis struct {
	Host     string
	Port     int
	Password string
}

var Conf Config

func Init() {
	viper.SetConfigFile("appconfig/config.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic("err")
	}
	viper.Unmarshal(&Conf)
	fmt.Println("动态配置:", Conf)
}
